//q12.cpp
//This program takes two arrays and print whether their contect is the same
//
//Binyamin 11 Jan 2018
//========================================================================

#include<iostream>

using namespace std;

//have_same_elems
//intput: two arrays and their size.
//output: whether the arrays are the same in content.
bool have_same_elems(int arr1[], int arr2[], int size)
{
	int i; // looper.
	int swap; // used to switched a value location.
	bool flag;
	flag = false;
	if(size == 1)
		return arr1[0] == arr2[0];
	for(i=0;i<size;i++)
		if(arr1[size-1] == arr2[i])
		{
			//i--;
			swap = arr2[size - 1];
			arr2[size-1] = arr2[i];
			arr2[i] = swap;
			return have_same_elems(arr1, arr2, size-1);
		}
	return false;
}
//1. set two arrays
//2. print whether they are the same
int main()
{
	int arr1[] = {1, 2, 6, 5, 2};
	int arr2[] = {2, 5, 6, 2, 1};
	if(have_same_elems(arr1, arr2, 5)) cout << "The array content is the same" << endl;
	else cout << "The arrays content is different" << endl;
	return 0;
}
//output
//The array content is the same
